import axios, { AxiosRequestConfig } from "axios"

axios.defaults.baseURL = "http://hrotest.huokesaas.com"
const Net = {
	getJson: function (url: string, config: AxiosRequestConfig) {
		return new Promise(function (resolve, reject) {
			axios
				.get(url, config)
				.then(function (res) {
					resolve(res)
				})
				.catch(function (err) {
					reject(err)
				})
		})
	},
	postJson: function (url: string, params?: any, config?: AxiosRequestConfig) {
		return new Promise(function (resolve, reject) {
			axios
				.post(url, params, config)
				.then(function (res) {
					resolve(res)
				})
				.catch(function (err) {
					reject(err)
				})
		})
	},
}

export default Net
